{extend name="admin@index_layout"/}
{block name="main"}
<link rel="stylesheet" href="__STATIC__/admin/css/cms.css">
<div class="layui-card">
    <div class="layui-card-body">
        <form class="layui-form page-form" method="post">
            <div class="layui-tab">
                <ul class="layui-tab-title">
                    {volist name="sites" id="site" key="i" }
                    <li {if $i==1}class="layui-this"{/if}> {if $site.mark} <img src="/static/lang/image/{$site.mark}.png" title="{$site.name}">{/if} {$site.name}</li>
                    {/volist}
                </ul>
                <div class="layui-tab-content">
                    {volist name="sites" id="s" key="k" }
                    <div class="layui-tab-item {if $k==1}layui-show layui-this{/if}">
                        <input type="hidden" name="extra_data[{$k}][site_id]" value="{$s.id}"/>
                        <input type="hidden" name="extra_data[{$k}][id]" value="{$info[$k-1]['id']|default=''}"/>
                        <input type="hidden" name="extra_data[{$k}][catid]" value="{$catid}"/>
                        <div class="layui-form-item">
                            <label class="layui-form-label"> {:getSiteName($k)}标题</label>
                            <div class="layui-input-block">
                                <input autocomplete="off" class="layui-input" name="extra_data[{$k}][title]" lay-verify="required" placeholder="{:lang('Category Title',[],$s['mark'])}" type="text" value="{$info[$k-1]['title']|default=''}" lay-verify="required"  lay-reqText="{:getSiteName($k)}标题不能为空">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label" title="{:lang('SEO Keyword',[],$s['mark'])}">
                                {:getSiteName($k)}关键词
                            </label>
                            <div class="layui-input-block">
                                <input autocomplete="off" class="layui-input" name="extra_data[{$k}][keywords]" placeholder="{:lang('SEO Keyword',[],$s['mark'])}" type="text" value="{$info[$k-1]['keywords']|default=''}">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label" title="{:lang('SEO Description',[],$s['mark'])}">
                                {:getSiteName($k)}描述
                            </label>
                            <div class="layui-input-block">
                                <textarea class="layui-textarea" name="extra_data[{$k}][description]" placeholder="{:lang('SEO Description',[],$s['mark'])}">{$info[$k-1]['description']|default=''}</textarea>
                            </div>
                        </div>
                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">缩略图</label>
                            <div class="layui-input-block layui-upload">
                                {:Form::image("extra_data[$k][thumb]",isset($info[$k-1]['thumb'])?$info[$k-1]['thumb']:'')}
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">创建时间</label>
                            <div class="layui-input-block">
                                <input type="text" name="extra_data[{$k}][inputtime]" class="layui-input datetime" value="{$info[$k-1]['inputtime']|default=date('Y-m-d H:i:s',time())}">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block editor">
                                <label class="layui-form-label">{:getSiteName($k)}内容 </label>
                                <script type="text/plain" class="js-ueditor" id="content{$k}" name="extra_data[{$k}][content]" lay-verify="required" lay-reqText="内容不能为空" >{$info[$k-1]['content']|default=''|raw}</script>
                                <a class="layui-btn layui-btn-sm" id="content{$k}grabimg" style="margin-top: 4px;">图片本地化</a>
                                <a class="layui-btn layui-btn-sm" id="content{$k}filterword" style="margin-top: 4px;">检测违禁词</a>
                            </div>
                        </div>
                    </div>
                    {/volist}
                </div>
            </div>
            <input type="hidden" name="modelField[catid]" value="{$catid}">
            <div class="layui-form-item layer-footer">
                <div class="layui-input-block">
                    {if (isset(cache("Cms_Config")['data_import']) && 1 == cache("Cms_Config")['data_import'] && 1 != cache("Cms_Config")['site'])}
                    <button class="layui-btn layui-btn-danger btn-import iconfont icon-dibu" type="button" title="一键同步主站数据，然后修改再提交！">数据同步</button>
                    {/if}
                    <button class="layui-btn iconfont icon-send" lay-submit> 立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary iconfont icon-trash"> 重置</button>
                </div>
            </div>
        </form>
    </div>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
    layui.use('yznForm', function() {
        var yznForm = layui.yznForm;
        yznForm.listen('', function (res) {
            layer.msg("更新成功！",{icon: 1});
            setTimeout('window.location.reload()',1000);
        });

        $('.btn-import').on('click', function(e) {
            layer.msg("同步成功！",{icon: 1});
            $(window).scrollTop(0);
            location.href = '{:url("add",["catid"=>$catid,"import"=>1])}';
        });
    });
</script>
{/block}
